package com.csh.order.recv;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RibbtMqConfig {
    //交换机
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange("public_ribbit_mq");
    }
    //队列
    @Bean
    public Queue goodsQueue(){
        return new Queue("public_goods_num");
    }
    //把对列绑定在交换机上
    @Bean
    public Binding goodsToicExchange(){
        return BindingBuilder.bind(goodsQueue()).to(topicExchange()).with("binding_goods");
    }
}
